﻿namespace ServerBase.Config;

/// <summary>
/// 系统配置
/// </summary>
public static partial class Conf
{


    // 服务器工具列表

    //多语言
    public static Dictionary<string, ConfigLanguage> ConfToolLanguage = new Dictionary<string, ConfigLanguage>();

    ////道具
    //public static Dictionary<int, ConfigItem> ConfToolItem = new Dictionary<int, ConfigItem>();
    //public static Dictionary<string, ConfigItem> ConfToolItemExt = new Dictionary<string, ConfigItem>();
    ////英雄
    //public static Dictionary<int, ConfigHero> ConfToolHero = new Dictionary<int, ConfigHero>();
    //public static Dictionary<string, ConfigHero> ConfToolHeroExt = new Dictionary<string, ConfigHero>();


    // 初始化配置文件
    public static bool InitConfTool()
    {
        bool result = true;

        result = InitConfSystem();

        //多语言
        if (result) { result = ReadConfig(typeof(ConfigLanguage).Name, ref ConfToolLanguage); }
        ////道具
        //if (result) { result = ReadConfig(typeof(ConfigItem).Name, ref ConfToolItem); }
        //ConfToolItemExt.Clear();
        //foreach (var item in ConfToolItem.Values)
        //{
        //    var k = "";
        //    if (ConfToolLanguage.TryGetValue(item.Name, out var conflang))
        //    {
        //        k = $"{item.Id}|{conflang.LangChs}";
        //    }
        //    else
        //    {
        //        k = $"{item.Id}|{item.Name}";
        //    }
        //    ConfToolItemExt[k] = item;
        //}
        ////英雄
        //if (result) { result = ReadConfig(typeof(ConfigHero).Name, ref ConfToolHero); }
        //ConfToolHeroExt.Clear();
        //foreach (var item in ConfToolHero.Values)
        //{
        //    var k = "";
        //    if (ConfToolLanguage.TryGetValue(item.Name, out var conflang))
        //    {
        //        k = $"{item.Id}|{conflang.LangChs}";
        //    }
        //    else
        //    {
        //        k = $"{item.Id}|{item.Name}";
        //    }
        //    ConfToolHeroExt[k] = item;
        //}

        return result;
    }

}
